CC=arm-apple-darwin9-g++
Sysroot=/var/toolchain/sys30

LDFLAGS=    -lobjc \
		-ObjC++ \
        -framework Foundation \
        -framework UIKit \
        -framework CoreFoundation \
		-framework CFNetwork \
        -multiply_defined suppress \
        -L$(Sysroot)/usr/lib \
        -F$(Sysroot)/System/Library/Frameworks \
        -F$(Sysroot)/System/Library/PrivateFrameworks \
        -dynamiclib \
        -init _GFWInterceptorInitialize \
        -Wall \
        -Werror \
        -lsubstrate \
        -lobjc \
        -ObjC++ \
        -fobjc-exceptions \
        -march=armv6 \
        -mcpu=arm1176jzf-s \
        -fobjc-call-cxx-cdtors

CFLAGS= -dynamiclib -I$(Sysroot)/usr/include

Objects= GFWInterceptorLibrary.o

Target=GFWInterceptor.dylib

all:    $(Target)

install:
		cp $(Target) /Library/MobileSubstrate/DynamicLibraries/
		cp layout/Library/PreferenceLoader/Preferences/GFWInterceptor.png /Library/PreferenceLoader/Preferences/
		cp layout/Library/PreferenceLoader/Preferences/GFWInterceptorSettings.plist /Library/PreferenceLoader/Preferences/
		respring

uninstall:
		rm -f /Library/MobileSubstrate/DynamicLibraries/$(Target)
		respring
package:
		mv $(Target) layout/Library/MobileSubstrate/DynamicLibraries/
		dpkg-deb -b layout/ gfwinterceptor.deb

$(Target):  $(Objects)
		$(CC) $(LDFLAGS) -o $@ $^
		ldid -S $(Target)

%.o:    %.mm
		$(CC) -c $(CFLAGS) $< -o $@

clean:
		rm -f *.o $(Target)
		rm -f *.deb

